Overview

Row

Total Positive Tests at CU Boulder

1271

Total Positive Tests BoCo

4371

Percent BoCo Total from CU Boulder

29.08 %

Current 7-Day Avg at CU Boulder

Row

Overlap of CU Boulder with BoCo Totals

Population of CU Boulder vs. Boulder County

Add useful numbers, population of Boulder County 326,196 , number of CU Students, 33,246 account for population density of CU students within Boulder

Data

CU Boulder Covid-19 Dataset

---
title: "Alt CU Boulder Covid Dash"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    source_code: embed
---


 



```{r setup, include=FALSE}
pacman::p_load(flexdashboard, ggplot2, tidyr, scales, DT, plotly,
               zoo)
```

Overview
=======================================================================

Row
-----------------------------------------------------------------------

```{r}
df <- read.csv("20201105_cu_covid.csv", header = TRUE, na.strings = c("",NA))   #readin
df$boco_cumulative <- cumsum(df$boco_new_cases)                                 #cumulative sum BoCo
df$Date <- as.Date(df$report_date, format="%m/%d/%y")                           #format date
```

### Total Positive Tests at CU Boulder

```{r}
wardTotal <- max(df$cu_total_pos_pcr, na.rm = TRUE)
valueBox(wardTotal, "Total CU Boulder Cases", color = "black")
```

### Total Positive Tests BoCo

```{r}
bcTotal <- sum(df$boco_new_cases, na.rm = TRUE)
valueBox(bcTotal, "Total Boulder County Cases", color = "black")
```

### Percent BoCo Total from CU Boulder

```{r}
perCU <- round(wardTotal/bcTotal*100,2)
valueBox(paste(perCU, "%"), "Percent Boulder County Cases from CU", color = "gold")
```

### Current 7-Day Avg at CU Boulder

```{r}
cu_rolling_avg <- rollmean(df$cu_positive_pcr, k = 7, na.rm = TRUE)          #7 day average CU Boulder
gauge(value = cu_rolling_avg[length(cu_rolling_avg)],
      min = 0, max = max(cu_rolling_avg), sectors = gaugeSectors(colors = "gold"))
```

Row
-----------------------------------------------------------------------

### Overlap of CU Boulder with BoCo Totals

```{r}
df_2 <- df %>% gather(source, cases_count, c(cu_total_pos_pcr, boco_cumulative))

chart2 <- ggplot(data = df_2, aes(x = Date, y = cases_count, fill = source, alpha = source)) + 
  geom_bar(stat = "identity", position = "identity") +
  theme(axis.text.x = element_text(angle = 45)) + 
  scale_alpha_manual(values=c(.3, .8)) +
  ggtitle("Cumulative COVID-19 Total from Aug 24, 2020") +
  scale_fill_manual("legend", values = c("boco_cumulative" = "black", "cu_total_pos_pcr" = "gold"))
  

ggplotly(chart2)
```

### Population of CU Boulder vs. Boulder County

```{r}
p <- c(326196, 33246)
s <- c("Boulder County", "CU Boulder")
x <- c("Population", "Population")

pop <- as.data.frame(p,s)

ggplot(data = pop, aes(x = x, y = p, fill = s)) + 
  geom_bar(stat = "identity", position = "identity") +
  scale_alpha_manual(values=c(.3, .8)) + 
  scale_y_continuous(labels = comma) +
  ylab("Population") + xlab("") +
  scale_fill_manual("s", values = c("Boulder County" = "black", "CU Boulder" = "gold"))
```

Add useful numbers, population of Boulder County 326,196 , number of CU Students, 33,246 account for population density of CU students within Boulder

Data
==============================================================

### CU Boulder Covid-19 Dataset

```{r}
datatable(df)
```